clearvars

filePath = matlab.desktop.editor.getActiveFilename;
fprintf('%s\n',filePath);

repository_base = fileparts(fileparts(filePath));

if ~exist(fullfile(repository_base, "scripts", "libs", "bvaloader"))
   fprintf('%s', "bvaloader was not found")
   fprintf("\n")
   fprintf('%s', "Please clone 'https://github.com/stefanSchinkel/bvaloader.git' repository into REPO_BASE\scripts\libs") 
   fprintf("\n")
   return
end

if ~exist(fullfile(repository_base, "scripts", "libs", "eeglab"))
   fprintf('%s', "eeglab was not found.") 
   fprintf("\n")
   fprintf('%s', "Please clone 'https://github.com/sccn/eeglab.git' repository into 'REPO_BASE\scripts\libs'")
   fprintf("\n")
   return
end

for session_idx = 1:11
   run epoch_exporter.m
   clearvars
end

for session_idx = 1:11
   run plotter.m
   clearvars
end

clearvars
run grand_plotter.m

clearvars
run grand_topo_plotter.m

